﻿#include "mybutton.h"

myButton::myButton(QWidget *parent):QPushButton(parent)
{

}

void myButton::paintEvent(QPaintEvent *event)
{
    QPainter painter(this);
    setFixedSize(60,60);//设置初始大小
    painter.setRenderHint(QPainter::Antialiasing,true);
    QPen pen=painter.pen();
    pen.setWidth(2);
    pen.setColor(Qt::red);
    painter.setPen(pen);
    QFont font=painter.font();
    font.setBold(true);
    painter.setFont(font);
    painter.drawEllipse(rect());
    painter.drawText(rect(),Qt::AlignCenter,"按钮1");
}
